Methods in route

  • STEP

    Folllowings are some of the commonly used http methods: These methods basically corresponds to create, read, update and delete operations.

    Http Method CRUD Purpose Response
    POST CREATE Used to create a record in the database 201 - created, 404 - Not Found, 409 - Conflict
    GET READ Used to list records from the database 200 - Ok, 404 - Not Found
    PUT UPDATE Used to update or replace record in database 405 - Not allowed, 200 - Ok, 204 - No Content, 404 - Not Found
    PATCH UPDATE Used to update or modify the records in the database 200 - Ok, 204 - No Contents. 404 - Not Found
    DELETE DELETE Used to delete a record from the table 200 - Ok, 404 - Page Not Found

    1. POST - commonly used method to create new record or resource. Form is submitted via POST method and data submitted via this method can not be seen via browser url. When record is created successfully it returns with 201 status code.

    2. GET - commonly used method to read single or multiple records or resource. It is basically read only method. It does not modify any data.

    3. PUT - commonly used method to update data or to create data in case client supply the id that needs to be updated.

    4. PATCH - commonly used method to update partial data in the database rather then supplying all data for a single record.

    5. DELETE - commonly used method to delete a record or resource